<template>
    <div>
        <cjc-nav title="常用表格" btn2="首页" @customRouter="customRouter" :btn3="timeOut + 's'"></cjc-nav>
        hello table
    </div>
</template>

<script>
export default {
    name: 'home',
    data() {
        return {
        }
    },
    created() {
        this.$store.commit('SET_timeOut', 60)
    },
    methods: {
        customRouter() {
            this.$router.push({
                path: '/home'
            })
        }
    },
    computed: {
        timeOut() {
            const Vm = this
            let time = setTimeout(() => {
                // console.log(Vm.$store.state.timeOut)
                Vm.$store.state.timeOut -= 1
            }, 1000)
            if (Vm.$store.state.timeOut > 0) {
                return Vm.$store.state.timeOut
            } else {
                clearTimeout(time)
                Vm.$store.commit('SET_timeOut', 0)
                return Vm.$store.state.timeOut
            }
        }
    },
    components: {
        cjcNav: () => import('@/components/common/Nav.vue'),
    }
}
</script>

<style>

</style>
